home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-12-20 | 2.8 KB | 133 lines | [TEXT/CWIE] |
- #include "ocheaders.h"
- #include "CBaseControl.h"
- #include "CErrorControl.h"
- #include "CTick.h"
- #include "CTickerControl.h"
- #include "CError.h"
- #include "CTickerError.h"
- #include "FnAssert.h"
-
- #define MControl ((CTickerControl *)mControl)
-
- ///////////////////////////////////////////////////////////////////////////////
- //
- // CTickerError::CTickerError
- //
-
- CTickerError::CTickerError(ErrorCode error) : CError(error)
- {
- }
-
- CTickerError::CTickerError(ErrorCode error, CErrorControl * control)
- : CError(error, control)
- {
- }
-
- CTickerError::CTickerError(ErrorCode error, CTick * tick)
- : CError(error)
- {
- mTick = tick;
- mControl = (mTick ? mTick->mControl : NULL);
- }
-
- ///////////////////////////////////////////////////////////////////////////////
- //
- // CTickerError::Init
- //
- void CTickerError::Init(ErrorCode error, CErrorControl * control)
- {
- inherited::Init(error, control);
-
- mTick = NULL;
- }
-
- ///////////////////////////////////////////////////////////////////////////////
- //
- // CTickerError::HandleError
- //
-
- void CTickerError::HandleError(void)
- {
- switch ( mErrorCode )
- {
- case CONTROL_GWORLD_ALLOCATION_ERROR:
- {
- ASSERT((MControl != NULL), "Unexpected null control in error handler!");
- if ( MControl->mOffscreenGWorld != NULL )
- {
- DisposeGWorld( MControl->mOffscreenGWorld );
- MControl->mOffscreenGWorld = NULL;
- MControl->mPixOffscreenPixMap = NULL;
- }
-
- break;
- }
-
- case TICK_GWORLD_ALLOCATION_ERROR:
- {
- ASSERT((MControl != NULL), "Unexpected null control in error handler!");
- if ( mTick->mGWorld )
- DisposeGWorld( mTick->mGWorld );
- mTick->mGWorld = NULL;
- mTick->mPixMap = NULL;
-
- break;
- }
-
- case NAME_TOKENIZE_ALLOCATION_ERROR:
- case VALUE_TOKENIZE_ALLOCATION_ERROR:
- break; // handled in CTickerControl's general cleanup
-
- case FONTINFO_ALLOCATION_ERROR:
- break;
-
- case TICK_NAME_ALLOCATION_ERROR:
- case TICK_VALUE_ALLOCATION_ERROR:
- {
- // if we can't set allocate the name or the value, don't use this tick
-
- ASSERT((MControl != NULL), "Unexpected null control in error handler!");
- if ( mTick != NULL )
- {
- // Delete the Tick in the new que, if it's there. Note that we
- // assume the NEW que (mQNew) here because that's where things
- // get put when we're parsing.
- deque<CTick*>::iterator it = MControl->mQNew.begin();
- while (it != MControl->mQNew.end())
- {
- CTick* pTick = *it;
- ASSERT((pTick != NULL), "NULL Tick!") ;
- if ( pTick == mTick )
- {
- MControl->mQNew.erase(it, it);
- break;
- }
- it++;
- }
-
- // delete the tick.
- delete mTick;
- mTick = NULL;
- }
-
- break;
- }
-
- case DATA_ALLOCATION_ERROR:
- {
- break;
- }
-
- case DATA_REALLOCATION_ERROR:
- {
- MControl->mData = MControl->mDataTemp;
- MControl->mDataTemp = NULL;
-
- break;
- }
-
- default:
- break;
- }
- }
-